package com.lims.algorithm.datastructure;

//Object表示泛型
public class MemoryCellMain{
	public static void main(String[] args) {
		MemoryCell m = new MemoryCell();
		m.write("37");
		String val = (String) m.read();
		System.out.println("contents are:" + val);
		
		m.write(new Integer(36));
		Integer wrapperVal = (Integer) m.read();
		int intVal = wrapperVal.intValue();
		System.out.println("contents:" + intVal);
	}
}

class MemoryCell {
	public Object storedValue;
	
	public Object read() {
		return storedValue;
	}
	public void write(Object x) {
		storedValue = x;
	}
}

